package  
{
	import flash.geom.Rectangle;
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.utils.Input;
	import net.flashpunk.FP;

	/**
	 * © 2012 TheJavaArcade.com
	 */
	public class SoundToggle extends Entity {
		
		private static var soundOn:Image = new Image(Assets.SOUND_SPRITE, new Rectangle(0, 0, 18, 18));
		private static var soundOff:Image = new Image(Assets.SOUND_SPRITE, new Rectangle(18, 0, 18, 18));
		
		public function SoundToggle() {
			x = 570;
			y = 1;
			if (Assets.isMuted) graphic = soundOff;
			if (!Assets.isMuted) graphic = soundOn;
			setHitbox(18, 18);
		}
		
		override public function update():void {
			if (collidePoint(x, y, Input.mouseX, Input.mouseY) && Input.mousePressed) {
				
				if (Assets.isMuted) {
					Assets.isMuted = false;
					graphic = soundOn;
				}else {
					Assets.isMuted = true;
					graphic = soundOff;
				}
			}
		}
		
	}

}